<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
<head>
<meta http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<link rel=Edit-Time-Data href="file:///C|/Documents%20and%20Settings/Jinyu%20Wang/Desktop/xdk_nt_10_1_0_2_0_production/xdk_nt_10_1_0_2_0_production/xdk/doc/cpp/./Getting_Started_CPP_files/editdata.mso">
<title>Getting started with XDK C++ </title>
<style>
<!--
.Section1
	{page:Section1;}
-->
</style>
</head>
<body bgcolor=#FFFFFF link="#663300" vlink="#996633" class="Normal" lang=EN-US> 
  <h1>Getting Started with Oracle XDK C++ </h1> 
  <p>March 31, 2006</p> 
  <h2>1. Introduction</h2> 
  Oracle XDK C++ Components are the basic building blocks for reading, manipulating, transforming, and validating XML documents. The Oracle XDK C++ components include:
  <ul type=disc> 
    <li style='color:black;'>XML Parser: supports parsing XML documents with the DOM or SAX interfaces.</li> 
    <li style='color:black;'>XSL Processor: supports transforming XML documents.</li> 
    <li style='color:black;'>XML Schema Processor: supports parsing and validating XML files against an XML Schema definition file (.xsd).</li> 
    <li style='color:black;'>Class Generator for C++: generates a set of C++ source files based on an input DTD or XML schema. The generated classes are then used in a C++ program to construct XML documents conforming to the DTD or XML schema.</li> 
  </ul> 
  <p>This document describes how to  install the Oracle XDK C++  and set up the development environment.</p> 
  <h2>2. Installation of XDK C++</h2> 
  <p>If you have installed the Oracle Database or Oracle AS (Application Server), you should have the XDK installed and can skip the following steps. Note that the Oracle XDK directory will be referred  as $XDK_HOME or %XDK_HOME% and  the Oracle home directory will be referred to as $ORACLE_HOME or %ORACLE_HOME% in the following sections.</p> 
  <p>If you haven't installed the Oracle Database or Oracle AS, you can download  Oracle XDK from OTN. You'll need to follow the following steps: </p> 
  <ul type=disc>
    <li style='color:black;'>Visit the Oracle XDK OTN homepage at <a href="http://www.oracle.com/technology/tech/xml/xdkhome.html">http://www.oracle.com/technology/tech/xml/xdkhome.html</a> </li> 
    <li>Select a release from the <strong>Releases</strong> section on the right-hand side of the page</li>
    <li> Click on the <strong>Software</strong> link  in the section of the release on the right-hand side of the product release home page </li>
    <li style='color:black;'>Log in with your OTN username and password (registration is free if you don't already have an account).</li> 
    <li style='color:black;'>Select the platform download </li> 
    <li style='color:black;'>Accept  the licensing agreement and/or complete the download survey</li> 
    <li style='color:black;'>Click on the appropriate *.tar.gz or *.zip file and download the Oracle XDK archive file </li> 
    <li style='color:black;'> Extract the downloaded file:</li> 
    <ul type=disc> 
      <li style='color:black;'>Choose a directory under which you would like to install Oracle XDK (e.g. C:\xdk)</li> 
      <li style='color:black;'>Extract the    downloaded Oracle XDK archive file to this directory. For example:</li> 
    </ul> 
    <blockquote>
      <pre>UNIX: tar xvfz xdk_xxx.tar.gz&nbsp;&nbsp;<br>Windows: use </tt><a href="http://www.winzip.com/">WinZip</a></pre>
    </blockquote>
  </ul> 
   
  <p>After installing the Oracle XDK C++, you should see the following&nbsp;directory structure related to the C++ components:</p> 
  <p>-$XDK_HOME</tt><br>
  &nbsp;&nbsp;|- bin: executable files</tt><br>
  &nbsp;&nbsp;|- lib: library files.</tt><br>
  &nbsp;&nbsp;|- nls/data: NLS data files (*.nlb)</tt><br>
  &nbsp;&nbsp;|- xdk</tt><br>
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;| - demo/cpp: demonstration code</tt><br>
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;| - doc/cpp: documentation</tt><br>
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;| - include: header files</tt><br>
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;| - mesg: message files (*.msb)</tt></p> 
  <p>The following compilers are used to compile the Oracle XDK C++ components on each platform:</p>
  <ul>
    <li>Windows NT: Visual C++ 6.0 </li>
    <li> Sun Solaris: Sparcworks for C++ 6.1</li>
    <li> Linux:  Intel C++ Compiler (ICC) 8.1</li>
  </ul>
  <h2>3. Setup the Environment</h2> 
  <h3>3.1 UNIX/LINUX Setup for XDK C++ </h3> 
  <h4>3.1.1 XDK C++ Components</h4> 
  <p>The following tables list all the libraries  in the UNIX/LINUX versions of the XDK C++ :</p> 
  <table border=1 cellspacing=0 cellpadding=0> 
    <tr> 
      <td valign=top bgcolor="silver" class="Normal"> <p align=center style='text-align:center'><b>Component</b></p></td> 
      <td valign=top bgcolor="silver" class="Normal"> <p align=center style='text-align:center'><b>Library</b></p></td> 
      <td valign=top bgcolor="silver" class="Normal"> <p align=center style='text-align:center'><b>Notes</b></p></td> 
    </tr> 
    <tr> 
      <td valign=top class="Normal"> <p>XML Parser and XSLT VM(Virtual Machine) </p>        </td> 
      <td valign=top class="Normal"> <p>libxml10.a</p></td> 
      <td valign=top class="Normal"> <p>XML Parser  supports both DOM and SAX XML Parsing;<br>
        XSLT VM supports 
      compiling XSL stylesheets, XSLT transformations and XPath queries. </p></td> 
    </tr> 
    <tr> 
      <td valign=top class="Normal"> <p>XML Schema Validator</p></td> 
      <td valign=top class="Normal"> <p>libxsd10.a</p></td> 
      <td valign=top class="Normal"> <p>Validating XML documents against XML schemas</p></td> 
    </tr> 
    <tr> 
      <td valign=top class="Normal"> <p>Class Generator</p></td> 
      <td valign=top class="Normal"> <p>libxmlg10.a</p></td> 
      <td valign=top class="Normal"> <p>Generating C++ classes based on DTDs or XML schemas</p></td> 
    </tr> 
</table> 
<p><strong>Table 1: Libraries for XDK C++ Components</strong></p>
  <p>The XDK C++ Components depend on the Oracle CORE, Oracle NLS(National Language Support) libraries, which are listed in the following table: </p>
  <table border=1 cellspacing=0 cellpadding=0> 
    <tr> 
      <td valign=top bgcolor="silver" class="Normal"> <p align=center style='text-align:center'><b>Library</b></p></td> 
      <td valign=top bgcolor="silver" class="Normal"> <p align=center style='text-align:center'><b>Package Name</b></p></td> 
      <td valign=top bgcolor="silver" class="Normal"> <p align=center style='text-align:center'><b>Notes</b></p></td> 
    </tr> 
    <tr> 
      <td valign=top class="Normal"> <p>CORE Library</p></td> 
      <td valign=top class="Normal"> <p>libcore10.a</p></td> 
      <td valign=top class="Normal"> <p>Oracle CORE library</p></td> 
    </tr> 
    <tr> 
      <td valign=top class="Normal"> <p>NLS Library</p></td> 
      <td valign=top class="Normal"> <p>libnls10.a</p></td> 
      <td valign=top class="Normal"> <p>Oracle NLS common library</p></td> 
    </tr> 
    <tr> 
      <td valign=top class="Normal">&nbsp; </td> 
      <td valign=top class="Normal"> <p>libunls10.a</p></td> 
      <td valign=top class="Normal"> <p>Oracle NLS library for Unicode support</p></td> 
    </tr> 
</table> 
  <p><strong>Table 2: Libraries of dependent XDK C++ Components</strong></p>
  <p>Other system libs are <strong>libirc.a </strong>and <strong>libcxaguard.so.5</strong>. Please  refer to the sample Makefiles to check the dependency. </p>
  <h4>3.1.2 Environment Setup for Command Line Utilities </h4>
  <p>In order to run the Oracle XDK C++ command line utilities, you need to first check if the environment variable <span
style='font-size:10.0pt;font-family:"Courier New";color:black'>ORA_NLS10 is set to point to the location of the NLS encoding definition files. Otherwise, you will get the &quot;<em>Failed to initialize XML parser, error 201</em>&quot; error. If you install Oracle XDK via the installation of an Oracle database or an Oracle AS, you can set <span
style='font-size:10.0pt; font-family:"Courier New"; color:black; font-weight: bold;'>ORA_NLS10 as follows: </p>
  <pre>setenv ORA_NLS10 ${ORACLE_HOME}/nls/data</pre>
  <p>If no Oracle database or  Oracle AS installed, you can use the NLS encoding definition files shipped with the Oracle XDK OTN release (which is a subset&nbsp;of  the NLS encoding definition files shipped with the Oracle database/Oracle AS release) : </p>
  <pre>setenv ORA_NLS10 ${XDK_HOME}/nls/data</pre>
  <p><a name=error>Error message files are provided in the </a><span style='font-size:
10.0pt;font-family:"Courier New";color:black'>xdk/mesg/ directory. Files with the *.msb extension are machine-readable error message files and needed at runtime; files with the <span style='font-size:10.0pt;font-family:"Courier New";color:black'>*.msg extension are human-readable error message files which  include the description,  causes and  actions to take  for each error  . If you install Oracle XDK via the installation of an Oracle database or Oracle AS, the message files are stored in the $ORACLE_HOME/xdk/mesg directory. You can set <b><span
style='font-size:10.0pt;font-family:"Courier New";color:black'>ORA_XML_MESG</b> as follows: </p>
  <pre>setenv <b><span
style='font-size:10.0pt;font-family:"Courier New";color:black'>ORA_XML_MESG</b> ${ORACLE_HOME}/nls/data</pre>
  <p>If no Oracle database/Oracle AS  installed, you can set the environment variable <b><span
style='font-size:10.0pt;font-family:"Courier New";color:black'>ORA_XML_MESG</b> to point to the message files stored in $XDK_HOME/<span style='font-size:
10.0pt;font-family:"Courier New";color:black'>xdk/mesg/ directory: </p>
  <pre>setenv ORA_XML_MESG ${XDK_HOME}/xdk/mesg</pre>
  <p>After setting up the environment variables, you can start using Oracle XDK command-line utilities. </p>
  <p>First, the command-line utility called <strong>xml</strong></tt> in the $XDK_HOME/bin directory allow you to parse and transform XML documents. The <strong>xml</strong> command-utility  has the following options: 
  </p>
  <table border=0 cellpadding=0> 
    <tr>
      <td class="Normal">-B &lt;<em>BaseUri</em>&gt;</td>
      <td class="Normal">Set the Base uri for XSLT processor.<br>
BaseUri of http://pqr/xsl.txt resolves pqr.txt to http://pqr/pqr.txt</td>
    </tr>
    <tr> 
      <td class="Normal"> <p>-c</tt></p></td> 
      <td class="Normal"> <p>XML conformance check only, no validation</p></td> 
    </tr> 
    <tr> 
      <td class="Normal"> <p>-e &lt;<em>encoding</em></tt>&gt;</p></td> 
      <td class="Normal"> <p>Specify default input file encoding (&quot;incoding&quot;)</p></td> 
    </tr> 
    <tr> 
      <td class="Normal"> <p>-E &lt;<i>encoding&gt;</i></tt></p></td> 
      <td class="Normal"> <p>Specify DOM/SAX encoding (&quot;outcoding&quot;)</p></td> 
    </tr> 
    <tr> 
      <td class="Normal"> <p>-f</tt></p></td> 
      <td class="Normal"> <p>File - Interpret <document>&lt;document&gt; as filespec, not URI</p></td> 
    </tr> 
    <tr>
      <td class="Normal">-G &lt;xptr exprs&gt;</td>
      <td class="Normal">Evaluates XPointer scheme examples give in a file</td>
    </tr>
    <tr> 
      <td class="Normal"> <p>-h</tt></p></td> 
      <td class="Normal"> <p>Help - show usage help and full list of flags</p></td> 
    </tr> 
    <tr> 
      <td class="Normal"> <p>-i <i>&lt;n</i></tt><i>&gt;</i></p></td> 
      <td class="Normal"> <p>Number of times to iterate the XSLT processing</p></td> 
    </tr> 
    <tr> 
      <td class="Normal"> <p>-l <i>&lt;language</i></tt><i>&gt;</i></p></td> 
      <td class="Normal"> <p>Language for error reporting</p></td> 
    </tr> 
    <tr> 
      <td class="Normal"> <p>-o <i>&lt;XSLoutfile</i></tt><i>&gt;</i></p></td> 
      <td class="Normal"> <p>Specify output file of XSLT processor</p></td> 
    </tr> 
    <tr> 
      <td class="Normal"> <p>-p</tt></p></td> 
      <td class="Normal"> <p>P<b></b>rint document after parse</p></td> 
    </tr> 
    <tr>
      <td class="Normal">-P</td>
      <td class="Normal">Pretty prit from root element </td>
    </tr>
    <tr>
      <td class="Normal">-PP</td>
      <td class="Normal">Pretty print from root node (DOC); includes XMLDecl</td>
    </tr>
    <tr>
      <td class="Normal">-PE &lt;encoding&gt;</td>
      <td class="Normal">Specify encoding for -P or -PP output</td>
    </tr>
    <tr>
      <td class="Normal">-PX</td>
      <td class="Normal">Include XMLDecl in output always</td>
    </tr>
    <tr> 
      <td class="Normal"> <p>-s <i>&lt;stylesheet</i></tt><i>&gt;</i></p></td> 
      <td class="Normal"> <p>Style sheet - specifies the XSL style sheet</p></td> 
    </tr> 
    <tr> 
      <td class="Normal"> <p>-v</tt></p></td> 
      <td class="Normal"> <p>Version - display parser version then exit</p></td> 
    </tr> 
    <tr> 
      <td class="Normal"> <p>-V <i>&lt;var&gt;</i><i>&lt;value</i></tt><i>&gt;</i></p></td> 
      <td class="Normal"> <p>To test top level variables in CXSLT</p></td> 
    </tr> 
    <tr> 
      <td class="Normal"> <p>-w</tt></p></td> 
      <td class="Normal"> <p>Whitespace - preserve all whitespace</p></td> 
    </tr> 
    <tr> 
      <td class="Normal"> <p>-W</tt></p></td> 
      <td class="Normal"> <p>Warning - stop parsing after a warning</p></td> 
    </tr> 
    <tr> 
      <td class="Normal"> <p>-x</tt></p></td> 
      <td class="Normal"> <p>SAX - exercise SAX interface and print document</p></td> 
    </tr> 
  </table> 
  <p>Second, the <span style='font-size:10.0pt; font-family: "Courier New"; color:black; font-weight: bold;'>schema</tt> command-line utility can be used to validate XML documents against XML schemas. The  <span style='font-size:10.0pt; font-family: "Courier New"; color:black; font-weight: bold;'>schema command-line utility  takes two arguments: the XML instance document and optionally an XML schema file. It has the following options: </p> 
  <table border=0 cellpadding=0> 
    <tr> 
      <td class="Normal"> <p>-0</tt></p></td> 
      <td class="Normal"> <p>Always exit with code 0 (success)</p></td> 
    </tr> 
    <tr> 
      <td class="Normal"> <p>-e <i>&lt;encoding&gt;</i></tt></p></td> 
      <td class="Normal"> <p>Specify default input file encoding (&quot;incoding&quot;)</p></td> 
    </tr> 
    <tr> 
      <td class="Normal"> <p>-E <i>&lt;encoding</i></tt>&gt;</p></td> 
      <td class="Normal"> <p>Specify output/data/presentation encoding (&quot;outcoding&quot;)</p></td> 
    </tr> 
    <tr> 
      <td class="Normal"> <p>-i</tt></p></td> 
      <td class="Normal"> <p>Ignore provided schema file</p></td> 
    </tr> 
    <tr> 
      <td class="Normal"> <p>-o <i>&lt;num</i></tt>&gt;</p></td> 
      <td class="Normal"> <p>Validation options</p></td> 
    </tr> 
    <tr> 
      <td class="Normal"> <p>-p</tt></p></td> 
      <td class="Normal"> <p>Print instance document to stdout on success</p></td> 
    </tr> 
    <tr> 
      <td class="Normal"> <p>-u</tt></p></td> 
      <td class="Normal"> <p>Force the Unicode code path</p></td> 
    </tr> 
    <tr> 
      <td class="Normal"> <p>-v</tt></p></td> 
      <td class="Normal"> <p>Version - display version then exit</p></td> 
    </tr> 
  </table> 
  <p>Third, the <strong>xmlcg</strong></tt> command-line utility can be used to generate C++ classes from DTD or XML schemas. The  <strong>xmlcg</strong> command-line utility has the following options:</p> 
  <table border=0 cellpadding=0>
    <tr>
      <td class="Normal">-d &lt;name&gt;</td>
      <td class="Normal">DTD - Input is an external DTD; generates name.cpp and name.h</td>
    </tr>
    <tr>
      <td class="Normal">-o &lt;directory&gt; </td>
      <td class="Normal">Output - specify output directory</td>
    </tr>
    <tr>
      <td class="Normal">-e &lt;encoding&gt;</td>
      <td class="Normal">Encoding - specify input file encoding</td>
    </tr>
    <tr>
      <td class="Normal">-h Help</td>
      <td class="Normal">- show this usage help</td>
    </tr>
    <tr>
      <td class="Normal">-v Version</td>
      <td class="Normal">- show Class Generator version#</td>
    </tr>
    <tr>
      <td class="Normal">-s &lt;name&gt;</td>
      <td class="Normal">Schema - input is an XML Schema (spec. output name)</td>
    </tr>
  </table>
  <p>There are another new command-line utilities xsl and xvm which provides alternatives to transform XML documents. Please refer to OTN papers for more information. </p>
  <p>Finally, in addition to the command-line 


 utilities

discussed, Oracle XDK C++ can  also be invoked by writing C++ programs  using the Oracle XDK C++ APIs. To compile the C++ programs using Oracle XDK C++, can be compiled using the headers in the xdk/include/ directory and linked against the libraries in the <span style='font-size:10.0pt;font-family:"Courier New";color:black'>lib/ directory. Please refer to the <span style='font-size:10.0pt;font-family:"Courier New";color:black'>Makefile in the <span
style='font-size:10.0pt;font-family:"Courier New";color:black'>xdk/demo/ directory for the details on how to build your C++ programs. </p>
  <h3>3.2 Windows NT Setup of Oracle XDK C++</h3> 
  <h4>3.2.1 Components</h4> 
  <p>The following tables list all the libraries found in the Windows NT version of the Oracle XDK C++:</p> 
  <table border=1 cellspacing=0 cellpadding=0> 
    <tr> 
      <td valign=top bgcolor="silver" class="Normal"> <p align=center style='text-align:center'><b>Component</b></p></td> 
      <td valign=top bgcolor="silver" class="Normal"> <p align=center style='text-align:center'><b>Library</b></p></td> 
      <td valign=top bgcolor="silver" class="Normal"> <p align=center style='text-align:center'><b>Notes</b></p></td> 
    </tr> 
    <tr> 
      <td valign=top class="Normal"> <p>XML Parser and</p> 
        <p>XSLT Processor</p></td> 
      <td valign=top class="Normal"> <p>oraxml10.lib</p> 
        <p>oraxml10.dll</p></td> 
      <td valign=top class="Normal"> <p>XML Parser for C++, which includes DOM, SAX, XPath, and XSLT APIs</p></td> 
    </tr> 
    <tr> 
      <td valign=top class="Normal"> <p>XML Schema Validator</p></td> 
      <td valign=top class="Normal"> <p>oraxsd10.lib</p> 
        <p>oraxsd10.dll</p></td> 
      <td valign=top class="Normal"> <p>XML Schema Processor for C++</p></td> 
    </tr> 
    <tr> 
      <td valign=top class="Normal"> <p>Class Generator</p></td> 
      <td valign=top class="Normal"> <p>oraxmlg10.lib</p> 
        <p>oraxmlg10.dll</p></td> 
      <td valign=top class="Normal"> <p>Class Generator for C++</p></td> 
    </tr> 
  </table> 
<p><strong>Table 3: Libraries of XDK C++ Components</strong></p>
  <p>The XDK C++ Components depend on the Oracle CORE and NLS libraries, which are listed in the following table: <br>
&nbsp;</p>
  <table border=1 cellspacing=0 cellpadding=0> 
    <tr> 
      <td valign=top bgcolor="silver" class="Normal"> <p align=center style='text-align:center'><b>Library</b></p></td> 
      <td valign=top bgcolor="silver" class="Normal"> <p align=center style='text-align:center'><b>Package Name</b></p></td> 
      <td valign=top bgcolor="silver" class="Normal"> <p align=center style='text-align:center'><b>Notes</b></p></td> 
    </tr> 
    <tr> 
      <td valign=top class="Normal"> <p>CORE Library</p></td> 
      <td valign=top class="Normal"> <p>oracore10.lib</p> 
        <p>oracore10.dll</p></td> 
      <td valign=top class="Normal"> <p>Oracle CORE library</p></td> 
    </tr> 
    <tr> 
      <td valign=top class="Normal"> <p>NLS Library</p></td> 
      <td valign=top class="Normal"> <p>oranls10.lib</p> 
        <p>oranls10.dll</p></td> 
      <td valign=top class="Normal"> <p>Oracle NLS common library</p></td> 
    </tr> 
    <tr> 
      <td valign=top class="Normal">&nbsp; </td> 
      <td valign=top class="Normal"> <p>oraunls10.lib</p> 
        <p>oraunls10.dll</p></td> 
      <td valign=top class="Normal"> <p>Oracle NLS library for Unicode support</p></td> 
    </tr> 
</table> 
  <p><strong>Table 4: Libraries of dependent XDK C++ Components</strong></p>
  <h4>3.2.2 Environment Setup for Command Line Usage</h4> 
  <p>The XML parser and XSLT processor may be called as an executable by invoking <span
style='font-size:10.0pt;font-family:"Courier New";color:black'>bin\xml.exe</tt>. The options are listed in Section 3.1.2. </p> 
  <p>The Schema Validator may be called as an executable by invoking bin\schema.exe</tt> which takes two arguments: the XML instance document and optionally a default schema to apply. The options are listed in Section 3.1.2. </p> 
  <p>In order to run the command line executables, you need to first check if the environment variable <span
style='font-size:10.0pt;font-family:"Courier New";color:black'>ORA_NLS10</tt> is set to point to the location of the NLS encoding definition files. If you install the Oracle database, you can set it to be: </p> 
  <pre>set ORA_NLS10=%ORACLE_HOME%\nls\data</pre> 
  <p>If there is no Oracle database is installed, you can use the NLS encoding definition files which come with the XDK release (which are a subset&nbsp;of what is in the Oracle database release) by: </p> 
  <pre>set ORA_NLS10=%XDK_HOME%\nls\data</pre> 
  <p>Error message files are provided in the <span
style='font-size:10.0pt;font-family:"Courier New";color:black'>xdk\mesg/</tt> subdirectory. Files ending in <span
style='font-size:10.0pt;font-family:"Courier New";color:black'>.msb</tt> are machine-readable and needed at runtime; files ending in .msg</tt> are human-readable and include cause and action descriptions for each error. The messages files also exist in the %ORACLE_HOME%\xdk\mesg</tt> directory. If no Oracle database is installed, you should set the environment variable <b>ORA_XML_MESG</b></tt> to point to the <strong><i>absolute path</i></strong> of the <span
style='font-size:10.0pt;font-family:"Courier New";color:black'>xdk\mesg\</tt> subdirectory in XDK release: </p> 
  <pre>set ORA_XML_MESG=%XDK_HOME%\xdk\mesg</pre> 
  <p>The XDK components may also be invoked by writing code to use the supplied APIs. The code must be compiled using the headers in the xdk\include\</tt> subdirectory and linked against the libraries in the <span style='font-size:10.0pt;
font-family:"Courier New";color:black'>lib\</tt> subdirectory. See Make.bat</tt> in the <span
style='font-size:10.0pt;font-family:"Courier New";color:black'>xdk\demo\</tt> subdirectory for full details of how to build your program. </p> 
  <p>To compile the code in the command line environment, you need to set the path for cl compiler. </p> 
  <pre>&nbsp; </pre> 
  <pre
style='text-align:center'><img border=0 width=405
height=460 id="_x0000_i1025" src="../images/image004_cpp.jpg" NOSAVE
u1:shapes="_x0000_i1026"></pre> 
  <pre style='text-align:center'>Figure-1: Setup Path for cl compiler</pre> 
  <pre
style='text-align:center'>&nbsp;</pre> 
  <p>Go to the Start Menu and select Settings -&gt;Control Panel. In the pop up window of Control Panel, select the System icon and double click. A window named System Properties will pop up. Select Environment Tab and add the path of cl.exe to the PATH variable shown in Figure 3-1. </p> 
  <p>In addition, you need to update the Make.bat&nbsp;by adding the path of the libraries and header files to the compiling and linking commands: For example: Make.bat </p> 
  <pre>:COMPILE</pre> 
  <pre>set filename=%1</pre> 
  <pre>cl -c -Fo%filename%.obj %opt_flg%&nbsp; /DCRTAPI1=_cdecl /DCRTAPI2=_cdecl /nologo /Zl /Gy /DWIN32 /D_WIN32 /DWIN_NT&nbsp;</pre> 
  <pre>/DWIN32COMMON /D_DLL /D_MT /D_X86_=1 /Doratext=OraText -I. -I..\..\..\include&nbsp;</pre> 
  <pre><b>-ID:\Progra~1\Micros~1\VC98\Include</b> %filename%.cpp</pre> 
  <pre>goto :EOF</pre> 
  <pre>:LINK&nbsp;</pre> 
  <pre>set filename=%1</pre> 
  <pre>link %link_dbg% /out:..\..\..\..\bin\%filename%.exe /libpath:%ORACLE_HOME%\lib <b>/libpath:D:\Progra~1\Micros~1</b></pre> 
  <pre><b>\VC98\lib</b> /libpath:..\..\..\..\lib&nbsp; %filename%.obj oraxml9.lib oracore9.lib oranls9.lib oraunls9.lib user32.lib&nbsp;</pre> 
  <pre>kernel32.lib msvcrt.lib ADVAPI32.lib oldnames.lib winmm.lib</pre> 
  <pre>:EOF</pre> 
  <pre>&nbsp;&nbsp;&nbsp;&nbsp;</pre> 
  <pre>D:\Progra~1\Micros~1\VC98\Include: is the path for header files</pre> 
  <pre>D:\Progra~1\Micros~1\VC98\lib: is the path for library files</pre> 
  <p>Then, you should be able to use the Make.bat to compile and link the demo code and start programming using XDK C++ components. </p> 
  <h4>3.2.3 Using XDK C++ Components with Visual C ++</h4> 
  <p>If you use Microsoft Visual C++ as your compiler, you need to make sure that the environment variable ORA_NLS10 is set as discussed above. </p> 
  <p>In order for Visual C++ to be able to take the environment variable, you need to use the system setup for windows NT to define the environment variable. Go to the Start Menu and select Settings-&gt;Control Panel. In the pop up window of Control Panel, select the System icon and double click. A window named System Properties will pop up. Select Environment Tab and enter ORA_NLS10.</p> 
  <p align=center style='text-align:center'><img
border=0 width=411 height=467 id="_x0000_i1026" src="../images/image006_cpp.jpg"
u1:shapes="_x0000_i1027"></p> 
  <p align=center style='text-align:center'>Figure 2: Setup ORA_NLS33 Environment Variable</p> 
  <p>You need to make sure that the environment variable ORA_XML_MESG is set as discussed above. </p> 
  <p>In order for Visual C++ to be able to take the environment variable, you need to use the system setup for windows NT to define the environment variable. Go to the Start Menu and select Settings-&gt;Control Panel. In the pop up window of Control Panel, select the System icon and double click. A window named System Properties will pop up. Select Environment Tab and enter ORA_XML_MESG.</p> 
  <pre>&nbsp;</pre> 
  <pre
style='text-align:center'><img border=0 width=404
height=462 id="_x0000_i1027" src="../images/image008_cpp.jpg"
u1:shapes="_x0000_i1028"></pre> 
  <pre style='text-align:center'>Figure 3: Setup ORA_XML_MESG Environment Variable</pre> 
  <p>To set up the PATH for *.dll, please refer to the following figure: <br> 
&nbsp;<br> 
&nbsp;</p> 
  <p align=center style='text-align:center;'><img border=0 width=403 height=461 id="_x0000_i1028"
src="../images/image010_cpp.jpg" u1:shapes="_x0000_i1029"></p> 
  <p align=center style='text-align:center;'>Figure 4: Setup ORA_NLS33 Environment Variable</p> 
  <p>After opening a workspace in Visual C++ and including the *.cpp files for the project, you need to set the path for the project. Please go to the Tools menu in the menu bar and select Options. A window will pop up. Please select the Directory tab and set your include path and library path as shown in the following figure: </p> 
  <p align=center style='text-align:center;'><img border=0 width=413 height=317 id="_x0000_i1029"
src="../images/image012_cpp.jpg" u1:shapes="_x0000_i1030"></p> 
  <p align=center style='text-align:center;'>Figure 5: Setup include path in Visual C++ </p> 
  <p align=center style='text-align:center;'><img border=0 width=416 height=320 id="_x0000_i1030"
src="../images/image014_cpp.jpg" u1:shapes="_x0000_i1031"></p> 
  <p align=center style='text-align:center;'>Figure 6: Setup static library path in Visual C++</p> 
  <p>After setting the paths for the static libraries in %XDK_HOME\lib, you also need to set the library name in the compilation environment of Visual C++. </p> 
  <p>Go to the Project menu in the menu bar and select Settings. A window will pop up. Please select the Link tab in the Object/Library Modules field put the name of XDK C++ components' libraries: </p> 
  <p align=center style='text-align:center;'><img border=0 width=578 height=372 id="_x0000_i1031"
src="../images/image016_cpp.jpg" u1:shapes="_x0000_i1032"><br> 
    Figure 7: Setup static library in Visual C++ Project</p> 
  <p>After completing all of the above steps, you can compile and run the demos provided for XDK C++ Components. </p> 
  <h3>3.3 Class Generator Usage</h3> 
  <h4>Input</h4> 
  <p>Input is an XML document containing or referencing a DTD, an external DTD directly (<b>-d</b> option), or an XML Schema (<b>-s</b> option). If a complete XML document is provided, the document body itself is ignored; only the DTD is relevant, though the document must conform to the DTD. </p> 
  <h4>Output</h4> 
  <p>Output is a pair of C++ source files, .cpp and .h, named after the DOCTYPE if a complete XML document is input. For an external DTD or Schema, the name of the generated files must be provided. Constructors are provided for each class (element) that allow an object to be created in two different ways: initially empty, then adding the children or data after the initial creation, or created with the initial full set of children or initial data. A method is provided for #PCDATA (and Mixed) elements to set the data and, when appropriate, set an element's attributes. </p> 
  <h3>3.4 New API and old API</h3> 
  <p>This release includes new C++ API (see xml.hpp and xmlctx.hpp). The primary difference of new API is an introduction of interfaces to various XDK tools. These interfaces will replace old C++ API in future releases. The mapping of old C++ classes into new C++ interfaces is as follows:</p> 
  <p>Class XMLParser&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DOMParser and SAXParser interfaces (abstract classes)</p> 
  <p>DOM classes (Node, etc.)&nbsp;&nbsp;&nbsp;-&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;References to DOM nodes (NodeRef, AttrRef, etc.)</p> 
  <p>Class XSLProcessor&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Interfaces (abstract classes)&nbsp;Xsl::Transformer, Xsl::CompTransformer, Xsl::Compiler</p> 
  <p>Class XPath&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Interfaces (abstract classes) XPath::Processor, XPath::CompProcessor, XPath::Compiler</p> 
  <p>Class XMLSchema&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Interface (abstract class) SchemaValidator</p> 
  <h2>4. NLS Support</h2> 
  </div> 
  <p>The parser supports over 300 IANA character sets. These character sets include the following: </p> 
  <p><span
style='font-size:10.0pt;font-family:"Courier New";color:black'>UTF-8, UTF-16, UTF16-BE, UTF16-LE, US-ASCII, ISO-10646-UCS-2, ISO-8859-{1-9, 13-15}, EUC-JP, SHIFT_JIS, BIG5, GB2312, GB_2312-80, HZ-GB-2312, KOI8-R, KSC5601, EUC-KR, ISO-2022-CN, ISO-2022-JP, ISO-2022-KR, WINDOWS-{1250-1258}, EBCDIC-CP-{US,CA,NL,WT,DK,NO,FI,SE,IT,ES,GB,FR,HE,BE,CH,ROECE,YU,IS,AR1}, IBM{037,273,277,278,280,284,285,297,420,424,437,500,775,850,852,855,857,00858, 860,861,863,865,866,869,870,871,1026, 01140,01141,01142,01143,01144,01145,01146,01147,01148} </tt></p> 
  <p>Any alias of the above character sets that is found <a
href="http://www.iana.org/assignments/character-sets">here</a> may also be used. In addition, any character set specified in Appendix A, Character Sets, of the Oracle National Language Support Guide may be used with the exception of IW7IS960. However, it is recommended that you use IANA character set names for interoperability with other XML parsers. Also note that XML parsers are only required to support UTF-8 and UTF-16 so those character sets should be preferred. </p> 
  <p>In order to be able to use these encodings, you should have the <span style='font-size:10.0pt;
font-family:"Courier New";color:black'>ORACLE_HOME</tt> environment variable set to the location of your Oracle installation. This will enable the use of the NLS data files which contain data for all supported encodings. NLS data files are usually located in <span
style='font-size:10.0pt;font-family:"Courier New";color:black'>$ORACLE_HOME/nls/data</tt>. If you don't have an Oracle installation (no $ORACLE_HOME), you must set the environment variable <b><span
style='font-size:10.0pt;font-family:"Courier New";color:black'>ORA_NLS10</b></tt> to the <strong><i>absolute path</i></strong> of the <span
style='font-size:10.0pt;font-family:"Courier New";color:black'>nls/data/</tt> directory in the XDK installation. </p> 
  <p>Using this XDK with an Oracle 8i installation is not supported. If you wish to try it on Windows anyway, you should copy the CORE and NLS DLLs and the NLSDATA files that are supplied with this XDK to your Oracle 8i home. In addition, you should set the environment variable NLS_TIME_TZ_FORMAT to HH.MI.SSXFF AM TZH:TZM and the enviroment variable NLS_TIMESTAMP_TZ_FORMAT to DD-MON-RR HH.MI.SSXFF AM TZH:TZM. </p> 
  <p>The default input encoding (&quot;default_input_encoding</tt>&quot;) is UTF-8. That is, if an input document's encoding is not self-evident (by HTTP charset, Byte Order Mark, XMLDecl, etc), then the default input encoding will be assumed. It is recommended that you set the default encoding explicitly if using only single byte character sets (such as US-ASCII or any of the ISO-8859 character sets) since single-byte performance is by far the fastest. To force all documents to be read as a certain encoding, specify it as &quot;<span
style='font-size:10.0pt;font-family:"Courier New";color:black'>input_encoding</tt>&quot; (i.e. without the &quot;<span
style='font-size:10.0pt;font-family:"Courier New";color:black'>default</tt>&quot;). A forced encoding overrides BOM and XMLDecl, but not protocol declarations (such as HTTP charset). </p> 
  <p>The data encoding for DOM and SAX (&quot;data_encoding</tt>&quot;) should be chosen carefully. Single-byte encodings are the fastest, but can represent only a very limited set of characters. Next fastest is Unicode (UTF-16), and slowest are the multibyte encodings such as UTF-8. If input data cannot be converted to the data encoding without loss, an error will occur. So for maximum utility, a Unicode-based data encoding should be used, since Unicode can represent any character. If <span style='font-size:10.0pt;
font-family:"Courier New";color:black'>data_encoding</tt> is not specified, it defaults to the input encoding of the first document parsed. </p> 
  <p>The XML Schema validator supports various encodings.&nbsp;The schema file and instance XML document can be in different encodings.&nbsp;When a schema context is created via the function <b>schemaInitialize</b>, an internal encoding, which is single byte or Unicode, is chosen based on the setting of the provided parser's context (i.e., xmlctx).&nbsp;If the error message &quot;LSX-0016: schema and instance document have incompatible character sets&quot; is shown when validation is attempted, a new schema context with a new parser context in a multibyte encoding (i.e., UTF-8, UTF-16, etc.) needs to be created to proceed.&nbsp;Specifically, a new xmlctx needs to be created with its &quot;outencoding&quot; parameter set to the above-mentioned multibyte encoding and used in the new schema context's creation. <br> 
&nbsp;</p> 
</div> 
</body>
</html>
